const errorHandler = (err, req, res, next) => {
    console.error(err.stack);
    res.status(500).send({
      code: 500,
      message: 'Internal Server Error',
      error: process.env.NODE_ENV === 'development' ? err.message : undefined
    });
  };
  
  module.exports = errorHandler;